/* Janus Chat - Version 1.0
 * Authors: Matthew Perry
 *          Michael Freid
 *          Marc Latou
 *          Richard Lee
 *
 * The Janus Chat Client is a highly secured
 * peer-to-peer chat client designed to facilitate
 * the transfer of sensitive data or as a communication
 * medium for the extra paranoid
 *
 * This file contains the header for a wrapper
 * of the crypto++ RSA library so that Janus can encrypt
 * its session keys for AES message encryption */

#ifndef JRSA_H
#define JRSA_H

#include <string>
#include <utility>
#include <cryptopp/rsa.h>
using CryptoPP::RSA;

class jRsa
{
    private:
        static std::string encoder( char* data, unsigned int n, unsigned int e );

    public:
        typedef RSA::PrivateKey privateKey;
        typedef RSA::PublicKey publicKey;
  
        static std::pair<publicKey,privateKey> generateKeys( unsigned int length );
  
        static std::string encrypt( const std::string& message, publicKey& key );
        static std::string decrypt( const std::string& cipher, privateKey& key );

        static std::string serializePublicKey( const publicKey& key );
        static publicKey recoverKey( const std::string& sKey );
};

#endif
